import { DELETE, FILESubmit, GET, POST } from "./api";

const base = ''
// const base = '/longyuan'
// -----------龙源--------------------
// 获取项目
export const projects =  (param)=> {
    return GET(base + "/projects", param)
}

// 按时间维度获取用电数据
export const powerTradingData =  (param)=> {
    // ?projectIds=1&recordDate=2025-08-19
    return GET(base + "/powerTradingData", param)
}

// 按日期维度获取用电数据
export const dailySummary =  (param)=> {
    // ?projectIds=1,2&startDate=2025-08-19&endDate=2025-08-20
    return GET(base + "/dailySummary", param)
}

// 首页结算点数据
export const settlement =  (param)=> {
    // ?projectIds=1,2&startDate=2025-08-19&endDate=2025-08-20
    return GET(base + "/home/settlement", param)
}

// 按日期数据导出
export const dailySummaryExport =  (param)=> {
    // ?projectIds=1,2&startDate=2025-08-15&endDate=2025-08-25
    return GET(base + "/dailySummary/export", param, {'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
}

// 按时间导出数据
export const powerTradingDataExport =  (param)=> {
    // ?projectIds=1,2&recordDate=2025-08-20
    return GET(base + "/powerTradingData/export", param, {'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
}


// ---------时间数据增删改-----------
// 
export const insertApi =  (param)=> {
    return POST("/powerTradingData/insert", param)
}
// 
export const updateApi =  (param)=> {
    return POST("/powerTradingData/update", param)
}
// 
export const deleteApi =  (id)=> {
    return DELETE(`/powerTradingData/delete?id=${id}`)
}
// 
export const importApi =  (param)=> {
    return FILESubmit("/powerTradingData/import", param, {})
}

// ---------日期数据增删改-----------
// 
export const insertDayApi =  (param)=> {
    return POST("/dailySummary/insert", param)
}
// 
export const updateDayApi =  (param)=> {
    return POST("/dailySummary/update", param)
}
// 
export const deleteDayApi =  (id)=> {
    return DELETE(`/dailySummary/delete?id=${id}`)
}
// 
export const importDayApi =  (param)=> {
    return FILESubmit("/dailySummary/import", param, {})
}